package com.ssw.backend.controller;

import com.ssw.backend.Config.OnlineCounter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserCountController {
    @Autowired
    private OnlineCounter onlineCounter;

    /**
     * @auther: ssw
     * @description: 获取当前实时在线人数(精确度为60s范围内)
     * @param
     * @return: int
     */
    @GetMapping("/api/user/getOnlineCount/")
    public int getRealOnlineCount() {
        Integer onlines = onlineCounter.getOnlineCount();
        return onlines;
    }
}
